<template>
    <div class="inputNumber">
        <el-input-number 
            v-model="value"
            controls-position="right"
            :placeholder="calcPlaceholder"
            :disabled="calcDisabled"
            :precision="calcPrecision"
            @change='handleChange'
        >
        </el-input-number>
    </div>
</template>

<script>
export default {
    data() {
        return {
            value: undefined,
        }
    },
    props: {
        iptAttritube: {
            type: Object,
            default: () => {}
        }
    },
    computed:{
        calcPlaceholder(){
            return this.iptAttritube.guideText || '请填写'
        },
        calcDisabled(){
            let attr = JSON.parse(this.iptAttritube.fieldAttribute)
            return attr.disabled || false
        },
        calcPrecision(){
            let attr = JSON.parse(this.iptAttritube.fieldAttribute)
            return attr.precision
        },
    },
    methods: {
        handleChange() {
            let value = {
                value: this.value,
                state: true
            }
            this.$emit('handleChange', value)
        },
        defaultData(d) {
            d.map(item => {
                if(item.customFieldId == this.iptAttritube.id) {
                    this.value = item.value
                }
            })
        },
        removeSure() {
            
        }
    },
}
</script>